package domfarr.web.tapestry.services;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.transaction.annotation.Transactional;

import domfarr.entities.Contact;

@Transactional
public class JPAContactServiceImpl implements ContactService {
	
	@PersistenceContext
    EntityManager em;

	@SuppressWarnings("unchecked")
	public List<Contact> findAll() {
		return em.createNamedQuery("findAll").getResultList();
	}


	public Contact save(Contact contact) {
		em.persist(contact);
		return contact;
	}

}
